import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
#创建图形
img=np.zeros((512,512,3),np.uint8)
#绘制图形
cv.line(img,(0,0),(511,511),(255,0,0),5)
cv.rectangle(img,(384,0),(510,128),(0,255,0),3)
cv.circle(img,(447,63),63,(0,0,225),-1)
font=cv.FONT_HERSHEY_SIMPLEX#选取字体参数
cv.putText(img,'OpenCv',(10,500),font,4,(255,255,255),2,cv.LINE_AA)
#利用matplotlib显示图形 *python的数据可视化
plt.imshow(img[:,:,::-1])
plt.title('heihei'),plt.xticks([]),plt.yticks([])
plt.show()